package com.service.dao.enums;

import lombok.Getter;
import org.springframework.lang.Nullable;

/**
 * <dl>
 * <dt>back-end</dt>
 * <dd>Description:</dd>
 * <dd>Copyright: Copyright (C) 2015</dd>
 * <dd>Company: </dd>
 * <dd>CreateDate: 2019年12月05日</dd>
 * </dl>
 *
 * @author
 */
public enum  CoinsEnum {
    ALL(0,"ALL"),
    USDT(1,"USDT"),
    BTC(2, "BTC"),
    USDF(3, "USDF"),
    ETH(4, "ETH"),
    EXDF(5, "EXDF"),
    POINTS(6, "POINTS"),
    CNY(7, "CNY"),
    FIL(9, "FIL"),
    XCH(10, "XCH"),
    BZZ(11, "BZZ"),
    PHA(12, "PHA"),
    ;

    @Getter
    private Integer code;
    @Getter
    private String name;

    CoinsEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static CoinsEnum valueOf(int statusCode) {
        CoinsEnum status = resolve(statusCode);
        if (status == null) {
            throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
        }
        return status;
    }

    @Nullable
    public static CoinsEnum resolve(int statusCode) {
        for (CoinsEnum status : values()) {
            if (status.code == statusCode) {
                return status;
            }
        }
        return null;
    }

}
